﻿/// <reference path="~/Scripts/lib/knockout-2.2.0.js" />
/// <reference path="~/Scripts/app/config.js" />

/**
 @title:        model.workspace
 @description:  Model for general activity. Will be substituted in future to more specific model.
 @author:       Yuriy Shapovalov (shapovalov.yuri@gmail.com)
 */

define('model.activity',
    ['ko', 'config'],
    function (ko, config) {
        var
            _dc = null,
            settings = {},

            // Workspace model, probably should be used in vm.workspace component.
            // Should be able to build this object by received data from the server.
            Activity = function () {
                
                var self = this;
                self.id = ko.observable();
                self.name = ko.observableArray().extend({required: true});
                self.description = ko.observable();
                self.tasks = ko.observableArray();
                self.timer = ko.observable();
                self.date = ko.observable();

                return self;
            };
        Activity.Nullo = new Activity()
            .id(0)
            .name('')
            .description('')
            .tasks(0)
            .timer(0)
            .date(0)
        Activity.Nullo.isNullo = true;

        // TODO: Clarify what this datacontext mean. What is it for.
        Activity.datacontext = function (dc) {
            if (dc) { // assign new value from parameter, or just get existing one
                _dc = dc;
            }
            return _dc;
        };
        return Activity;

    });